﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MailSlot;

namespace GurLoaderHelper
{
    public class MailslotMessagePublisher : IMessagePublisher
    {
        private MailslotClient Client { get; set; }

        public MailslotMessagePublisher(string mailslotName)
        {
            if (string.IsNullOrEmpty(mailslotName))
                throw new ArgumentNullException("mailslotName");

            Client = new MailslotClient( mailslotName);
        }

        public void SendMessage(string message)
        {
            //MessageBox.Show(string.Format("Sending Message: {0}", message));
            Client.SendMessage(message);
        }
    }
}
